from selenium.webdriver.common.by import By
from Zk.Zk3.Page.Page import Page
import time
class Page3(Page):
    # 点击五粮液主题
    wuliangye_loc=(By.XPATH,'/html/body/div[4]/div/div[2]/div[2]/p/a[2]')
    def wuliangye(self):
        self.click(self.wuliangye_loc)
    # 点击商品详情
    shangp_loc=(By.XPATH,'//img[@src="https://img09.jiuxian.com/2025/0527/0551d711a5674d979db752684e93a55a4.jpg"]')
    def shangp(self):
        self.click(self.shangp_loc)
    # 加入购物车
    gouwuc_loc=(By.ID,'addToCartForDetail')
    def gouwuc(self):
        self.click(self.gouwuc_loc)
    # 查看购物车
    chakan_loc = (By.XPATH, '/html/body/div[2]/div/div[2]/ul/li[3]/a')
    def chakan(self):
        self.click(self.chakan_loc)
    # 去结算
    jiesuan_loc = (By.XPATH,'/html/body/div[3]/div[1]/div[3]/div[3]/a[1]')
    def jiesuan(self):
        self.click(self.jiesuan_loc)

    try:
        t=time.strftime('%H%m%d-%H%M%S',time.localtime())
        driver=time.localtime()
    except Exception as f:
        print(f)



    def test_jiuxian_wuliangye(self):
        self.test_jiuxian_login()
        self.wuliangye()
        # 切换窗口
        self.qiehuan()
        self.shangp()
        self.qiehuan()
        self.gouwuc()
        self.chakan()
        time.sleep(10)

